package com.tt.fashionWebSite.controller;

import com.tt.fashionWebSite.dto.EmailDto;
import com.tt.fashionWebSite.dto.JsonResponseCode;
import com.tt.fashionWebSite.dto.JsonResponseDto;
import com.tt.fashionWebSite.dto.LoaiDanhMucDto;
import com.tt.fashionWebSite.service.Ad_SetupEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * Created by isoft-work 5 on 12/5/2014.
 */
@Controller
public class Ad_SetupEmailController {
   @Autowired
   private Ad_SetupEmailService ad_setupEmailService;

   @SuppressWarnings("rawtypes")
   @RequestMapping(value = "/admin/setupEmail/getInfo", method = RequestMethod.GET)
   public @ResponseBody
   JsonResponseDto<EmailDto> adminProductListCategory(HttpServletRequest request) {
      return new JsonResponseDto<EmailDto>(ad_setupEmailService.getInfo(), JsonResponseCode.SUCCESS);
   }

   @SuppressWarnings("rawtypes")
   @RequestMapping(value = "/admin/setupEmail/updateInfo", method = RequestMethod.POST)
   public @ResponseBody
   JsonResponseDto<EmailDto> adminProductListCategory(HttpServletRequest request, @RequestBody EmailDto emailDto) throws IOException {
      return new JsonResponseDto<EmailDto>(ad_setupEmailService.updateInfo(emailDto), JsonResponseCode.SUCCESS);
   }
}
